<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage Commercial core plugins
 */


/**
 * Smarty number_format modifier plugin
 *
 * Type:     modifier<br>
 * Name:     number_format<br>
 * Date:     Oct 20, 2008
 * Purpose:  unified formatting for numbers
 * Input:    string
 * Example:  {$item.number|number_format}
 *           {1320182|number_format} -> "1 320 182"
 *           {1320182|number_format:2} -> "1 320 182,00"
 *           {1320182|number_format:-2} -> "1 320 100"
 * @author   Alex Yaroshevich <qfox@ya.ru>
 * @version 0.1
 * @param string with number
 * @return string
 */
function smarty_modifier_number_format( $number, $decimals = 0, $dec_point = ',', $thousands_sep = ' ' )
{
	$number = round( $number, $decimals );
	return number_format( $number, $decimals, $dec_point, $thousands_sep );
}

/* vim: set expandtab: */

?>
